import { defineNuxtPlugin } from '#app'
import {
  NButton,
  NTree,
  NModal,
  NForm,
  NCode,
  NFormItem,
  NInput,
  NSelect,
  NDataTable,
  NSpace,
  NAvatar,
  NList,
  NListItem,
  NTag,
  NDescriptions,
  NDescriptionsItem,
  NDialog,
  NThing,
  NScrollbar,
  NStatistic,
  NEmpty,
  NBadge,
  NGrid,
  NGridItem,
  NPagination,
  NUpload,
  NPopconfirm,
} from 'naive-ui'

// 手动导入常用的Naive UI组件
const components = {
  NButton,
  NTree,
  NModal,
  NForm,
  NFormItem,
  NCode,
  NInput,
  NSelect,
  NDataTable,
  NSpace,
  NAvatar,
  NList,
  NListItem,
  NTag,
  NDescriptions,
  NDescriptionsItem,
  NDialog,
  NThing,
  NScrollbar,
  NStatistic,
  NEmpty,
  NBadge,
  NGrid,
  NGridItem,
  NPagination,
  NUpload,
  NPopconfirm
}

export default defineNuxtPlugin((nuxtApp) => {
  // 注册所有组件
  Object.entries(components).forEach(([name, component]) => {
    nuxtApp.vueApp.component(name, component)
  })
})